import { GET_TOKEN, CLEAR_TOKEN } from '@/store/constants';
import { getToken } from '@/utils/token';
const init = {
  token: getToken(),
};
export default function login(state = init, active) {
  switch (active.type) {
    case GET_TOKEN:
      return { ...state, token: active.payload };
    case CLEAR_TOKEN:
      return { ...state, token: '' };
    default:
      return state;
  }
}
